import { BrowserWindow, BrowserWindowConstructorOptions, MenuItem, NativeImage } from 'electron'

export enum IpcEvent {
    APP_WINDOW_CREATE = 'APP_WINDOW_CREATE',
    APP_WINDOW_CLOSE = 'APP_WINDOW_CLOSE',
    APP_WINDOW_MAXIMIZE = 'APP_WINDOW_MAXIMIZE',
    APP_WINDOW_MINIMIZE = 'APP_WINDOW_MINIMIZE',
    APP_DEVTOOLS_TOGLE = 'APP_DEVTOOLS_TOGLE', // 打开控制台
    APP_ACTION_CODE = 'APP_ACTION_CODE', // 在主进程执行代码
    APP_SHORT_CUT_SET = 'APP_SHORT_CUT_SET', // 设置快捷键
    APP_SHORT_CUT_DEL = 'APP_SHORT_CUT_DEL', // 删除快捷键
    MENU_STEUP_APP = 'MENU_STEUP_APP', // 设置应用菜单
    MENU_STEUP_CONTEXT = 'MENU_STEUP_CONTEXT', // 设置右键菜单
    STORE_GET = 'STORE_GET',
    STORE_SET = 'STORE_SET',
    STORE_HAS = 'STORE_HAS',
    STORE_CLEAR = 'STORE_CLEAR',
    STORE_RESET = 'STORE_RESET',
    STORE_DELETE = 'STORE_DELETE',
    STORE_OPEN_IN_EDITOR = 'STORE_OPEN_IN_EDITOR',
    // 状态栏设置
    TRAY_SET_IMAGE = 'TRAY_SET_IMAGE', // 设置状态栏图标
    TRAY_SET_TITLE = 'TRAY_SET_TITLE', // 设置状态栏标题
    TRAY_SET_TOOLTIP = 'TRAY_SET_TOOLTIP', // 设置状态栏说明
    TRAY_SET_CONTEXT_MENU = 'TRAY_SET_CONTEXT_MENU', // 设置状态栏菜单
    // 消息对话框
    MESSAGE_BOX_NONE = 'MESSAGE_BOX_NONE',
    MESSAGE_BOX_INFO = 'MESSAGE_BOX_INFO',
    MESSAGE_BOX_ERROR = 'MESSAGE_BOX_ERROR',
    MESSAGE_BOX_QUESTION = 'MESSAGE_BOX_QUESTION',
    MESSAGE_BOX_WARNING = 'MESSAGE_BOX_WARNING',
    NOTIFICATION_BOX = 'NOTIFICATION_BOX',
    // 剪切板
    CLIPBOARD_WRITE = 'CLIPBOARD_WRITE',
    CLIPBOARD_CLEAR = 'CLIPBOARD_CLEAR',
    CLIPBOARD_READ_TEXT = 'CLIPBOARD_READ_TEXT',
    CLIPBOARD_READ_HTML = 'CLIPBOARD_READ_HTML',
    CLIPBOARD_READ_IMAGE = 'CLIPBOARD_READ_IMAGE',

    OPEN_URL = 'OPEN_URL',
    APP_EXIT = 'APP_EXIT',
}

export interface ClipboardWriteOption {
    text?: string
    html?: string
    image?: NativeImage
}
export interface ClipboardWrite {
    text?: string
    html?: string
    image?: string
}

export interface ShortCutOption {
    keys: string
    title: string
    fn: () => void
}

export type LogType = 'log' | 'error' | 'warn' | 'info' | 'debug'
export interface LogItem {
    type: LogType
    content: string
}

export interface BrowserWindowExtend extends BrowserWindow {
    name: string
}

export const enum UpdateStatus {
    Uninitialized,
    Idle,
    Checking,
    Available,
    Downloading,
    Downloaded,
    Updating,
    Ready,
}

export interface WindowOption {
    name: string
    pathname: string
    options: BrowserWindowConstructorOptions
}
